﻿using System;
using System.Net;

namespace FbHelperWP7NonUi.BookStorage.DropBoxStorage.AsyncHelpClasses
{
    internal sealed class GetFileEntryResult : AbstractAsyncResult
    {
        private readonly byte[] fileEntry;
                private readonly AsyncRequestCompleted<GetFileEntryResult> callback;

        private GetFileEntryResult( GetFileEntryData data, byte[] fileEntry, Exception error )
            : base( data, error )
        {
            this.fileEntry = fileEntry;
            this.callback = data.Callback;
        }

        public GetFileEntryResult( GetFileEntryData data, Exception error )
            : this( data, null, error )
        {
        }

        public GetFileEntryResult( GetFileEntryData data, byte[] fileEntry )
            : this( data, fileEntry, null )
        {
        }

        public byte[] GetFileEntry()
        {
            return ( byte[] )fileEntry.Clone();
        }

        public AsyncRequestCompleted<GetFileEntryResult> Callback
        {
            get
            {
                return callback;
            }
        }
    }
}
